package com.example.demo.lambda;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @Author xiao
 * @Date 2025/5/2 上午 11:31
 * @ClassName: FileOutPutStreamDemo
 * @Desc:
 */
public class FileOutPutStreamDemo {
    public  void redaFile() {
        try (InputStreamReader isr = new InputStreamReader(Files.newInputStream(Paths.get("D:\\Java\\JavaCode\\lessonCode\\AiJava\\Demo\\src\\main\\java\\com\\example\\demo\\lambda\\xiao.txt")));) {
            char[] chars = new char[2];
            int c = 0;
            while ((c = isr.read(chars)) != -1) {
                System.out.println(new String(chars, 0, c));
            }

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
